package com.usian.interceptor;


import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Component
public class LoginInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        Object category = request.getSession().getAttribute("category");
        /*
        * 用户的请求头 cookie 请求体 token、ticket*/
        String token = request.getParameter("token");

        if (token!=null && !"".equals(token)){
            return true;
        }
        return false;
    }
}
